package com.fpost.test;

import java.util.List;

import com.fpost.dao.impl.UserDAO;
import com.fpost.domain.Article;
import com.fpost.domain.ArticleVersion;
import com.fpost.domain.User;
import com.fpost.manager.ArticleManager;

public class HibernateTest3 {
	public static void main(String[] args) {
		
		User user = new UserDAO().get(18);
		System.out.println(user.getUsername());
		
		ArticleManager articleManager = new ArticleManager(); 
//		List<Article> articles = articleManager.getByUserId(user.getUserId());
//		for (Article article : articles) {			
//			System.out.println(article.getArticleId() + " " + article.getTitle());
//		}
		Article article = articleManager.get(15);
		System.out.println(article.getArticleId());
		List<ArticleVersion> articles = article.getVersions();
		for (ArticleVersion articleVersion : articles) {
			System.out.println(articleVersion.getArticleVersionId());
			System.out.println(articleVersion.getTitle());
			System.out.println(articleVersion.getBody());
		}
		
	}
}